Build your Elasticsearch index and run IntraMine

What's left? Decide which folders to index with Elasticsearch and monitor for changes, and then run one batch file to build the index, start the File Watcher service and start IntraMine.
If you later want to change the directories you're indexing, see
"Using IntraMine.txt#Adding files to indexed folders".

Configure folders to monitor

This is a vitally important step, so a bit of bold here to make sure your eyes don't skip.
As mentioned, we need to list directories and drives that Elasticsearch will index and the File Watcher service will monitor. These are listed in IntraMine's data/search_directories.txt config file. Kindly divert for a moment to
"Configuring folders to index and monitor.txt"
to set up your initial list of directories and drives. Come on back when you're done.
Done? Ok, you've told IntraMine which folders and drives you want to monitor and index, and IntraMine will use that list when you build your Elasticsearch index soon. And the batch file "IM_INIT_INDEX.bat" that builds the index will also call "make_filewatcher_config.pl" to create a configuration file for the File Watcher service, using the directories you've listed for monitoring in data/search_directories.txt.

Enable PowerShell and unblock a script

First, let's allow your PC to execute PowerShell scripts. Then we'll "unblock" the one script that IntraMine needs.

Enable PowerShell

For Windows 11: bring up Settings -> System -> For developers, and click on "PowerShell" to expand settings there. Turn on "Change execution policy to allow local PowerShell scripts..."
(If "For developers" doesn't appear under System -> Settings, try going to to Settings -> Privacy & security -> For developers, and look for the PowerShell setting there. And, just saying, your version of Windows 11 is out of date.)
If you don't allow local PowerShell scripts to run, IntraMine won't respond quickly to file changes, and will miss file and folder renames. So please allow it.

Unblock foldermonitor.ps1

This script provides IntraMine with rapid feedback on file changes Without it, there could be a 30-second delay before Intramine picks up on a file change and file/folder renames will be missed.
To unblock foldermonitor.ps1:

1. Bring up a Windows PowerShell prompt using "Run as Administrator". You can do that by searching for "Windows PowerShell" in the Search field on your task bar

2. Then go to IntraMine's bats/ folder and double-click on bats/Make_foldermonitor_command.bat

example Unblock-File command in that image, your path will be different

3. As suggested in the results of running that, copy the "Unblock..." line there (select, CTRL+C)

4. Back in your PowerShell prompt window, Paste and press Enter. Then you can close the window.

Index and run

This is easy enough, but building your initial file index may take a few minutes.

1. By now you should have entered the directories and drives in data/search_directories.txt that you want to be indexed by Elasticsearch and monitored by File Watcher. That's described in "Configuring folders to index and monitor.txt". Please do that now if you haven't yet.

2. (NOTE you need to use Run as administrator for this) Run bats/IM_INIT_INDEX.bat as found in your IntraMine folder, in a Command Prompt window. This will ask Elasticsearch to index all files in the directories you've specified, and also create a configuration file for File Watcher so it will monitor directories, as you've spelled out in data/search_directories.txt, and stop/start the File Watcher service. Then it will start IntraMine.

3. Go away for a bit. The initial build could take roughly 30 minutes for 250,000 files, and after it gets going you'll see how many files are being indexed. I don't do a lot of varied development, but I know it's easy to have 250,000 source and text files kicking around. Looking at you Qt.

4. IntraMine will start up when the indexing is complete. A newe tab called "Mon" will come up in your default browser, showing messages from IntraMine. When startup is complete you'll see a hummingbird and 'UP!'. You can then use the navigation bar at the top of the Mon page to visit IntraMine's Search or Files pages etc.

5. Stop or start IntraMine by running bats/STOP_INTRAMINE.bat or bats/START_INTRAMINE.bat. More about starting and stopping in "Using IntraMine.txt".

When IntraMine is running, it will keep your index up to date in near real time. For a single file edit, the lag is five seconds. If you add a hundred files, the lag will be maybe ten seconds. If you plan on adding thousands of files at once to a folder that's already being indexed, you should expect IntraMine to respond sluggishly or not at all for Search, Edit, and Viewer changes. Or you can just completely re-index everything by running bats/IM_INIT_INDEX.bat again, or even better use the Reindex service (see Reindex.html).

Problem starting IntraMine?

After the index build, did a second command prompt window come up mentioning uninitialized variable errors? Use Ctrl+c in both windows, close them, and then try this:

1. Fire up regedit.msc

2. Navigate to HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\

3. Make a new DWORD key there called "InheritConsoleHandles"

4. Leave its value at the default 0.

5. Try starting IntraMine by running bats/START_INTRAMINE.bat (which will be your normal way of starting IntraMine). You should get a clean start.

Visit IntraMine

Point your browser to http://127.0.0.1:81/Search - use your own main port number if you changed it from 81, and if you're not on your IntraMine box, substitute its LAN IP address for 127.0.0.1 in the URI above. (As you might know, type "ipconfig /all" at a command prompt on your IntraMine box to see the LAN IP).

A couple of quick tests

Go to the Search page (see just above) and do a search for something you know should be indexed. Are you seeing reasonable results? The total number of files indexed is shown at the top right of the Search dialog, and the background there should be green, meaning your Elasticsearch index is fine.
Bring up the Status page by clicking on "Status" in the top navigation bar. Make a small change to a source or text file that's being indexed. You should see the Watcher's status light flash after about five seconds.

Stop and start

To stop IntraMine, double-click on bats\STOP_INTRAMINE.bat. Try not to use CTRL+C, it will rudely stop all servers. STOP_INTRAMINE.bat sends a polite request to all servers, and they will wrap up whatever they're doing before quitting.
And later you can re-start IntraMine by double-clicking bats\START_INTRAMINE.bat as found in your IntraMine folder.
Do come back to the docs and read "Using IntraMine.txt" at least, when the initial thrill wears off🙂
Next: Starting, stopping, and visiting IntraMine.txt.
contents.txt